//
//  NYGradeItemViewController.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/9.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYGradeItemViewController.h"

#import "NYGradeItemViewCell.h"
#import "NYGradeItemListModel.h"

@interface NYGradeItemViewController ()

@end

@implementation NYGradeItemViewController

#pragma mark - Life Cycle Methods

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initUI];
}
#pragma mark - Intial Methods
- (void)initUI {
    
    self.tableView.backgroundColor = UIColorMakeWithHex(@"#FFFFFF");

    
}
- (void)initTableView {
    
    [super initTableView];
}
- (void)configNimbus {
    
    [super configNimbus];
    self.tableViewModel.delegate = self;
}
#pragma mark - Network Methods

#pragma mark - Target Methods

#pragma mark - Public Methods

#pragma mark - Private Method

#pragma mark - External Delegate

#pragma mark - UITableViewDelegate,UITableViewDataSource
- (UITableViewCell *)tableViewModel:(NITableViewModel *)tableViewModel cellForTableView:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
    UITableViewCell *cell = [super tableViewModel:tableViewModel cellForTableView:tableView atIndexPath:indexPath withObject:object];
    if ([cell isKindOfClass:[NYGradeItemViewCell class]]) {

        NYGradeItemViewCell *itemCell = (NYGradeItemViewCell *)cell;
        @weakify(self);
        itemCell.itemBlock = ^(NYGradeItemListModel *itemModel) {
            
            @strongify(self);
            if (self.itemBlock) self.itemBlock(itemModel);
            NSLogInfo(@"被点击");
        };
    }
    return cell;
}

#pragma mark - Setter Getter Methods
- (void)setItemMutaArray:(NSMutableArray *)itemMutaArray {
    
    _itemMutaArray = itemMutaArray;
    
    [self configNimbus];
    [self.tableViewModel removeAll];
    [self.tableViewModel addObjectsFromArray:_itemMutaArray];
    [self.tableView reloadData];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
